package china.song314.testcode;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class TestCollections {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		String key = "e";
		System.out.println(Arrays.binarySearch(array, key));
		
		List<String> list = Arrays.asList(array);
		System.out.println(Collections.binarySearch(list, key));
		
		ArrayList<String> arrayList = new ArrayList<String>();
		for (int i = 0; i < array.length; i++) {
			arrayList.add(array[i]);
		}
		System.out.println(Collections.binarySearch(arrayList, key));
		System.out.println(arrayList.toString());
		System.out.println(Arrays.toString(array));
		
	}
	
	static String[] array = {"a", "b", "c", "d", "e"};
	

}
